//
// Created by 郝羽 on 2018/5/22.
//

#ifndef RTC_XSWITCH2_REMOTE_MIXER_HPP
#define RTC_XSWITCH2_REMOTE_MIXER_HPP

#include <string>
#include <netinet/in.h>

struct rmixer;

struct rmixer_stream;

struct rmixer_callback {
    void (*on_stream_destroy)(void* data, uint32_t stream);
    void (*on_stream_new)(void* data, uint32_t stream);
    void (*on_stream_data)(void* data, uint32_t stream, const unsigned char* buf, int size);
};

rmixer* rmixer_new(const char* mixer_id, rmixer_callback cb, void* data);

void rmixer_del(rmixer* mixer);

// 调用者应该调用g_free释放返回值
const char* rmixer_get_local_address(rmixer* mixer);

void rmixer_send_data(rmixer* mixer, const unsigned char* buf, int size);

void rmixer_handle_timeout(rmixer* mixer, int64_t now);

int rmixer_join(rmixer *mixer, sockaddr_in sa);

#endif //RTC_XSWITCH2_REMOTE_MIXER_HPP
